import request from '@/utils/request'

const modelName = 'system-farm'

// 基地列表
export const farmList = (offset, pageSize, cityName, type) => {
  return request({
    url: modelName + '/system/farm/farmList',
    method: 'get',
    params: {
      offset: offset,
      pageSize: pageSize,
      cityName: cityName,
      type: type,
    },
  })
}

// 省份列表
export const provinceList = () => {
  return request({
    url: modelName + '/system/farm/provinceList',
    method: 'get',
  })
}

// 城市列表
export const cityList = data => {
  return request({
    url: modelName + '/system/farm/cityList',
    method: 'get',
    params: {
      provinceName: data,
    },
  })
}
// 区县列表
export const countyList = data => {
  return request({
    url: modelName + '/system/farm/countyList',
    method: 'get',
    params: {
      cityName: data,
    },
  })
}
//保存基地
export const saveFarmValue = data => {
  return request({
    url: modelName + '/system/farm/saveFarm',
    method: 'post',
    data,
  })
}
//修改基地
export const putFarmValue = data => {
  return request({
    url: modelName + '/system/farm/putFarm',
    method: 'put',
    data,
  })
}
//删除基地
export const deleteFarmValue = data => {
  return request({
    url: modelName + '/system/farm/deleteFarm/' + data,
    method: 'delete',
  })
}
//删除基地
export const allFarmTypes = () => {
  return request({
    url: modelName + '/system/farm/allFarmTypes',
    method: 'get',
  })
}
